/*
 * @Description: count的容器组件
 * @Author: 姚泽毅
 * @Date: 2021-09-01 08:59:37
 * @LastEditTime: 2021-09-02 11:40:26
 */
import { connect } from 'react-redux'
import CountUI from '../../component/Count'
import { createIncrementAction, createDecrementAction, createIncrementAsyncAction } from '../../redux/count_action'
//connect(映射状态，映射操作状态的方法)(UI组件)
//connect(mapStateToProps,mapDispatchToProps)(componentUI)
export default connect(
    state => ({ count: state }),
    // mapDispatchToProps一般写法
    // dispatch => (
    //     {
    //         increment: number => dispatch(createIncrementAction(number)),
    //         decrement: number => dispatch(createDecrementAction(number)),
    //         incrementAsync: (number, time) => {
    //             dispatch(createIncrementAsyncAction(number, time))
    //         }
    //     }
    // )

    // mapDispatchToProps精简写法
    {
        increment: createIncrementAction,
        decrement: createDecrementAction,
        incrementAsync: createIncrementAsyncAction
    }
)(CountUI)
